package com.plian.system.controller.pm.property;

import com.plian.Tools.base.BaseController;
import com.plian.Tools.pagedata.PageData;
import com.plian.system.model.ListResult;
import com.plian.system.model.ObjResult;
import com.plian.system.service.pm.property.PropertyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartHttpServletRequest;

@RestController
@RequestMapping(value = "api/property")
public class PropertyController extends BaseController {
    @Autowired
    PropertyService propertyService;

    @PostMapping(value = "/save")
    public ObjResult save(@RequestBody PageData pd) throws Exception {
        return propertyService.save(pd);
    }

    @PostMapping(value = "/edit")
    public ObjResult edit(@RequestBody PageData pd) throws Exception {
        return propertyService.edit(pd);
    }
    @PostMapping(value = "/isRepeat")
    public ObjResult isRepeat(@RequestBody PageData pd) throws Exception {
        return propertyService.isRepeat(pd);
    }


    /**
     * 根据id查询
     * @param pd
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/findid")
    public ObjResult findid(@RequestBody PageData pd) throws Exception {
        return propertyService.findbyid(pd);
    }

    /**
     * 根据id查询数据及从表数据
     * @param pd
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/findidAll")
    public ObjResult findbyidAll(@RequestBody PageData pd) throws Exception {
        return propertyService.findbyidAll(pd);
    }

    /**
     * 根据集合删除数据
     * @param pd
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/del_id")
    public ObjResult delids(@RequestBody PageData pd) throws Exception {
        return propertyService.delid(pd);
    }
    /**
     * 查询列表
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/list")
    public ListResult listpage(@RequestBody PageData pd) throws Exception {
        return propertyService.list(pd);
    }
    @PostMapping(value = "/chlidList")
    public ObjResult chlidList(@RequestBody PageData pd) throws Exception {
        return propertyService.chlidList(pd);
    }
    @PostMapping(value = "/chlidTree")
    public ObjResult chlidTree() throws Exception {
        return propertyService.chlidTree();
    }
    @PostMapping(value = "/upLoad")
    public ObjResult upLoad(MultipartHttpServletRequest request){
        return propertyService.upLoad(request);
    }
    @PostMapping(value = "/reportList")
    public ListResult reportList(@RequestBody PageData pd){
        return propertyService.reportList(pd);
    }
    @PostMapping(value = "/record")
    public ListResult record(@RequestBody PageData pd){
        return propertyService.record(pd);
    }

    /**
     * 查询列表
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/fillingList")
    public ListResult fillingList(@RequestBody PageData pd) throws Exception {
        return propertyService.fillingList(pd);
    }
    @PostMapping(value = "/reportListPage")
    public ListResult reportListPage(@RequestBody PageData pd){
        return propertyService.reportListPage(pd);
    }
}
